
APPLICATION_FILE_EXTENTION 	= c
APPLICATION_SRC_PATH     	= $(MAIN_APPLICATION_PATH)/source
APPLICATION_OBJS_PATH    	= $(MAIN_OBJS_PATH)/APPLICATION
APPLICATION_DEPS_PATH		= $(MAIN_DEPS_PATH)/APPLICATION
APPLICATION_CFLAGS			= $(MAIN_CODE_CFLAGS)
APPLICATION_DEPEND_CFLAGS	= $(MAIN_DEPEND_CFLAGS)

APPLICATION_INCLUDE = $(addprefix -I, $(APPLICATION_INCLUDE_PATH))
APPLICATION_SRCS   = $(wildcard $(APPLICATION_SRC_PATH)/*.$(APPLICATION_FILE_EXTENTION))
APPLICATION_OBJS   = $(addprefix $(APPLICATION_OBJS_PATH)/,$(notdir $(subst .$(APPLICATION_FILE_EXTENTION),.o,$(APPLICATION_SRCS))))
APPLICATION_DEPS	  = $(addprefix $(APPLICATION_DEPS_PATH)/,$(notdir $(subst .$(APPLICATION_FILE_EXTENTION),.d,$(APPLICATION_SRCS))))
ALL_OBJS 	 += $(APPLICATION_OBJS)
ALL_DEPS	 += $(APPLICATION_DEPS)

$(APPLICATION_DEPS_PATH)/%.d : $(APPLICATION_SRC_PATH)/%.$(APPLICATION_FILE_EXTENTION)
	@$(MKDIR) $(APPLICATION_DEPS_PATH)
	@echo Making $(notdir $@) ...
	@$(CC) $(APPLICATION_DEPEND_CFLAGS) $(APPLICATION_INCLUDE) $< | sed 's/$*.o:/$(subst /,\/,$(APPLICATION_OBJS_PATH))\/$*.o:/g' > $@
	@echo Done!

-include $(APPLICATION_DEPS)

$(APPLICATION_OBJS_PATH)/%.o : $(APPLICATION_SRC_PATH)/%.$(APPLICATION_FILE_EXTENTION)
	@$(MKDIR) $(APPLICATION_OBJS_PATH)
	@echo Making $(notdir $@) ...
	@$(CC) $(APPLICATION_CFLAGS) $(APPLICATION_INCLUDE) $< -c -o $@
	@echo Done!


